import request from '@/utils/request'
export function getAllType() {
  return request({
    url: '/lesson/types/all',
    method: 'get'
  })
}

export function updateNameAndStateById(id, name, state) {
  return request({
    url: '/lesson/types/update',
    method: 'post',
    data: {
      id: id,
      typeName: name,
      typeState: state
    }
  })
}

export function getClassTypeById(id) {
  return request({
    url: '/lesson/types/',
    method: 'get',
    params: {
      typeId: id
    }
  })
}

export function add(name, image, state, order) {
  return request({
    url: 'lesson/types/append',
    method: 'post',
    data: {
      typeName: name,
      typeImg: image,
      typeState: state,
      order: order
    }
  })
}

export function update(id, name, image, state, order) {
  return request({
    url: '/lesson/types/update',
    method: 'post',
    data: {
      id: id,
      typeName: name,
      typeImg: image,
      typeState: state,
      order: order
    }
  })
}

export function deleteById(id) {
  return request({
    url: '/lesson/types/remove',
    method: 'post',
    data: {
      typeId: id
    }
  })
}
